module.exports =  {
    updateUser:function(client, user, cb) {
        var sql = 'update player set nickName = ? , score = ?, coin = ? , diamond = ? where id = ?';
        var args = [user.nickName , user.level , user .score , user.coin , user.diamond , user.id];
        client.query(sql, args, function(err, res) {
            if(err !== null) {
                console.error('write mongodb failed!　' + sql + ' ' + JSON.stringify(user) + ' stack:' + err.stack);
            }
            if(!!cb && typeof cb == 'function') {
                cb(!!err);
            }
        });
    }
};
